//
//  CardView.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/6/7.
//

#import "CardView.h"
#import "CommonUtil.h"

@interface CardView()


@end

@implementation CardView
-(instancetype)init{
    if (self = [super init]) {
        self.backgroundColor = RandomColor;
        [self addSubview:self.codeLabel];
    }
    return self;
}


-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSLog(@"%zd",self.tag);
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.codeLabel.centerX = self.width/2;
    if (kIs_iPhoneX) {
        self.codeLabel.bottom = self.height - AD(40);
    }else{
        self.codeLabel.bottom = self.height - AD(140);
    }
    
    NSLog(@"%f",self.codeLabel.bottom);
}


-(UILabel *)codeLabel{
    if (!_codeLabel) {
        _codeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, AD(100), AD(25))];
        _codeLabel.textAlignment = NSTextAlignmentCenter;
        _codeLabel.text = @"邀请码";
        _codeLabel.font = [UIFont systemFontOfSize:AD(23)];
        _codeLabel.textColor = [UIColor whiteColor];
    }
    return _codeLabel;
}
@end
